package com.lagou.service.impl;

import com.lagou.dao.BlogRepository;
import com.lagou.pojo.Article;
import com.lagou.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("blogService")
@Transactional
public class BlogServiceImpl implements BlogService {

    @Autowired
    BlogRepository blogRepository;

    @Override
    public List<Article> findAll() {
        List<Article> articles = blogRepository.findAll();
        return articles;
    }

    @Override
    public Page<Article> findPageAll(Pageable pageable) {
        Page<Article> pageAll = blogRepository.findAll(pageable);
        return pageAll;
    }
}
